import pymysql

# # Open database connection
# db = pymysql.connect(host='localhost', user="root", password="123456", database="cangku",autocommit=True)
#
# # prepare a cursor object using cursor() method
# cursor = db.cursor()
#
# sql_02 = "select * from products where number = '1'"
# sql_03 = "select * from products where type = '滑轮'"
# sql_01 = "delete from products where number = '1'"
# cursor.execute(sql_03)
# result = cursor.fetchall()
# print(result)
# 查看更新后的结果

def mysql_select(get_size):
    db = pymysql.connect(host='localhost', user="root", password="123456", database="cangku")
    cursor = db.cursor()
    cursor.execute("select * from products where size ='%s'" % (get_size))
    result = cursor.fetchall()
    print(result)
    db.close()
    return result
